#!/bin/sh

#cd `dirname $0`
#获取软连接的真实路径
DIR=`S=\`readlink "$0"\`; [ -z "$S" ] && S=$0; dirname $S`
cd "$DIR"

echo `pwd`

today=`date +"%Y%m%d"`

#exit

ip="192.168.4.240"
psw="jianmi1314"


#ip="192.168.4.74"
#psw="123456"

#cd portability-service

#排除多余的文件夹，配置文件等
#sshpass -p "$psw" rsync -aP "-e ssh -p 22" --exclude={WEB-INF/*,\.*,business_*,*.sql} ./WebRoot/ $ip:/data/jianmi-cloud-old/business_sms_manage_sqlserver/

sshpass -p "$psw" ssh -p 22 $ip "rm -f /data/http-mock/lib/http-mock-*.jar"
#sshpass -p "$psw" ssh -p 22 $ip "rm -f /data/http-mock/lib/*.jar"

#所有的包
sshpass -p "$psw" rsync -aP "-e ssh -p 22" ./target/dependency/*.jar $ip:/data/http-mock/lib/
sshpass -p "$psw" rsync -aP "-e ssh -p 22" ./target/http-mock-*.jar $ip:/data/http-mock/lib/


#所有的包

#sshpass -p "$psw" rsync -aP "-e ssh -p 22" ./src/main/resources/proxool.xml $ip:/data/http-mock/classes/
sshpass -p "$psw" rsync -aP "-e ssh -p 22" ./src/main/resources/ $ip:/data/http-mock/classes/

sshpass -p "$psw" ssh -p 22 $ip "cd /data/http-mock/bin;./stop.sh;./start.sh"
sshpass -p "$psw" ssh -p 22 $ip "tail -f /data/http-mock/logs/stdout.log"